<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/component/commonTagLib.jsp" %>
<!DOCTYPE html>
<html>
<head>
<title><spring:message code="message.lable.compinfoSTDsee"/></title>
 <%@ include file="/WEB-INF/component/commonCSS.jsp" %>
<!--[if lt IE 9]>
        <script src="lib/js/html5shiv.min.js"></script>
        <script src="lib/js/respond.min.js"></script>
    <![endif]-->
</head>
<body class="skin-blue-light sidebar-mini fixed skin-blue-light-frame">
    <section class="content-header">
       <h1>已遴选配送企业</h1>
        <ol class="breadcrumb">
            <li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i>首页</a></li>
            <li class="active"><a href="#">交易</a></li>
            <li class="active"><a href="#">配送关系</a></li>
            <li class="active"><a href="#">遴选结果查询</a></li>
        </ol>
    </section>

    <section class="content">
        <div class=" box box-success">
            <div class="box-body">
            <form action="${ctx}/stdCompinfo/exportExcel.html" id="exportExcel" method="post">
                <div class="input">
                <div class="textalign1"><spring:message code="message.listForm.qiYeMingCheng"/>：</div>
                    <div class="boxinput">
                        <input type="text" class="textinput" id="compName" name="compName" placeholder="<spring:message code="message.listForm.qiYeMingCheng"/>"/>
                    </div>
                <div class="textalign"><spring:message code="message.listForm.qiYeBianMa"/>：</div>
                    <div class="boxinput">
                        <input type="text" class="textinput" id="compCode" name="compCode" placeholder="<spring:message code="message.listForm.qiYeBianMa"/>"/>
                    </div>
                
                    <div class="textalign1" >
                           <button id="selectComp" type="button" onclick="likeQuery();" class="btn btn-success btn-sm"><spring:message code="message.button.seachSpacing"/></button>
                     </div>  
                </div>
            
            </form>
            </div>
          </div>
        
        <table class="jqgrid" id="gridlist"></table>
        <div id="gridpage"></div>
		<div class=" box box-warning bottongroup">
			<label id="submit" onclick="window.location.href='${ctx}/baseDel/toSelectDelAreaResult.html'" class="btn btn-danger btn-sm">返 回</label>
		</div>
    </section>
   <%@ include file="/WEB-INF/component/commonJS.jsp" %>
    <script src="${ctx}/lib/plugins/daterangepicker/moment.js"></script>
    <script src="${ctx}/lib/plugins/daterangepicker/daterangepicker.js"></script>
    <script type="text/javascript">
    function submit(){
    	var rowIds = $("#gridlist").jqGrid("getGridParam", "selarrrow") || [];
		if (rowIds.length <= 0) {
			$.HN.message.alert("请选择要操作的行！", "消息", "info");
			return;
		}
		var list = [];
		for (var i=0; i<rowIds.length; i++) {
			rowId = rowIds[i];
			list.push({"delRelId":rowId, "baseDelRange":$("#jc"+rowId).is(':checked'),"countyDelRange":$("#xy"+rowId).is(':checked')});
		}
		$.post("${pageContext.request.contextPath}/baseDel/confirmDelArea.html", {
			"array" : json.jsonToString(list),"areaCode":"${areaCode}"
		}, function(result) {
			var result = eval("("+result+")");
			alert(result.success);
			if (result.success) {
				gridSerch();
				$.HN.message.alert(result.msg, "消息", "success");
			} else {
				$.HN.message.alert(result.msg, "消息", "error");
			}
		}, "json")
    }
     //绑定回车
    $('#compCode,#compName').bind('keydown', function(event) {
        if (event.keyCode == "13") {        //13 位电脑上回车键的位置代码
            $('#selectComp').click();
        }
    }); 
  
    $("#compName").focus();//加载页面光标在第一个查询框内
    
        $(function() {
            $("#gridlist").jqGrid({
                    url : "${pageContext.request.contextPath}/baseDel/getSelectDelResultData.html?areaCode=${areaCode}&status=2",
                    mtype : "POST",
                    datatype : "json",
                    autowidth : true,
                    shrinkToFit:true,
                 //   height : 293,
                    colNames : [ 
                                 'id',
                                 '<spring:message code="message.listForm.qiYeBianMa"/>', 
                                 '<spring:message code="message.listForm.qiYeMingCheng"/>',
                                 '配送范围' 
                                 ],
                    colModel : [
                                {name : 'base_del_area_rel_id',width : 100,hidden:true,align : "center",sortable : false},
                                {name : 'del_comp_code',width : 100,align : "center",sortable : false},
                                {name : 'del_comp_name',width : 200,align : "left",sortable : false },
                                {name : 'del_range',width : 150,align : "center",sortable : false},
                    ],
                    rowNum : 20,
                    rowList : [ 10, 20, 50,100 ],
                    rownumbers : true,
                    pager : "#gridpage",
                    multiselect : false,
                    viewrecords : true,
                    gridComplete: function(){
					//序号列宽度自适应（参数为jqgridID）
					 autoRNWidth("gridlist");
					//数据只有一条时默认选中（参数为jqgridID）
					 selectByOneData("gridlist");
					 },
                    caption : "${areaName} — 配送企业",
                    jsonReader : {
                        repeatitems : false,
                        id : "base_del_area_rel_id"
                    }
                });
        
            $("#gridlist").jqGrid('navGrid', '#gridpage', {add : false,edit : false,del : false,search : false,refresh : false});
            $(window).trigger("resize");
			$("#gridlist").jqGrid("setGridHeight", create());
        });
        //tingyong
        //查询
        function likeQuery(page) {
            var compCode = $.trim($("#compCode").val());
            var compName = $.trim($("#compName").val());
        
            $("#gridlist").jqGrid('setGridParam',{
                    datatype:'json',
                    postData:{
                    	"areaCode":"${areaCode}",
                        "compCode":compCode,
                        "compName":compName,
                        "status":2},
                    page : page||1
            }).trigger("reloadGrid");
        }
        
        function detail(compId){
            $("#compCodeDetail").val(compId);
            $("#FormDetail").submit();
        }
      
        
        function exportExcel(){
    		$.HN.message.confirm('<spring:message code="message.lable.OKExport"/>&nbsp;<spring:message code="message.lable.compInfoxls"/>&nbsp;<spring:message code="message.lable.ma"/>', '', '').on(function (e) {
	               if (e) {
	            		  $("#exportExcel").submit();
			
	               }
         	 }); 
         	
    	} 
    </script>
</body>
</html>









